﻿using System;
using System . Collections . Generic;
using System . IO;
using System . Linq;
using System . Runtime . InteropServices . WindowsRuntime;
using Windows . Foundation;
using Windows . Foundation . Collections;
using Windows . UI;
using Windows . UI . Xaml;
using Windows . UI . Xaml . Controls;
using Windows . UI . ViewManagement;
using Windows . UI . Xaml . Media . Animation;
using Windows . UI . Xaml . Controls . Primitives;
using Windows . UI . Xaml . Data;
using Windows . UI . Xaml . Input;
using Windows . UI . Xaml . Media;
using Windows . UI . Xaml . Navigation;
using GameClassLibrary;

// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkID=390556

namespace RichMan4LApp
{
    /// <summary>
    /// An empty page that can be used on its own or navigated to within a Frame.
    /// </summary>
    public sealed partial class PlayerConfigPage : Page
    {
        public StartGameParameters Parameters { get; set; }

        public PlayerConfigPage ( )
        {
            this . InitializeComponent ( );
        }

        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo ( NavigationEventArgs e )
        {
            Parameters = e . Parameter as StartGameParameters;
        }

        private void Page_Loaded ( object sender , RoutedEventArgs e )
        {
            StartStoryBoard . Begin ( );
        }

        private void CreateGamePageButton_Click ( object sender , RoutedEventArgs e )
        {

            EasyPage . Navigate ( typeof ( CreateGamePage ) , Parameters , "Lime" , LeaveStoryBoard , BackGroundRect , Frame , RemoveControl , AddControl );

        }

        private void StartGameButton_Click ( object sender , RoutedEventArgs e )
        {
            EasyPage . Navigate ( typeof ( GamePage ) , Parameters , "Lime" , LeaveStoryBoard , BackGroundRect , Frame , RemoveControl , AddControl );


        }

        private void RemoveControl ( )
        {
            CreateGamePageButton . Click -= CreateGamePageButton_Click;
            StartGameButton . Click -= StartGameButton_Click;
        }

        private void AddControl ( )
        {
            CreateGamePageButton . Click += CreateGamePageButton_Click;
            StartGameButton . Click += StartGameButton_Click;
        }

    }
}
